//! 系统打印控制台

use core::fmt;

/// 向控制台打印格式化字符
#[inline(always)]
pub fn console_output(args: fmt::Arguments<'_>) {
    extern "Rust" {
        fn __console_output(args: fmt::Arguments<'_>);
    }
    unsafe {
        __console_output(args);
    }
}

/// 向控制台输出
#[macro_export]
macro_rules! print {
    ($($arg:tt)*) => {{
        $crate::print::console_output(core::format_args!($($arg)*));
    }};
}

/// 向控制台输出并换行
#[macro_export]
#[allow_internal_unstable(format_args_nl)]
macro_rules! println {
    () => {
        $crate::print!("\n")
    };
    ($($arg:tt)*) => {{
        $crate::print::console_output(core::format_args_nl!($($arg)*));
    }};
}
